﻿CREATE PROCEDURE [dbo].[GetUserProjectCategories]
@userID INT, @all BIT
AS
if (@all = 0)
begin
	select vw.* 
	from vwProjectCategory vw
	inner join Projects p on vw.ProjectID = p.ProjectID
	inner join ProjectMembers pm on p.ProjectID = pm.ProjectID
	where pm.UserID=@userID and p.StatusID = 1
end
else
begin
	select vw.* 
	from vwProjectCategory vw
	inner join Projects p on vw.ProjectID = p.ProjectID
	inner join ProjectMembers pm on p.ProjectID = pm.ProjectID
	where pm.UserID=@userID 
end

